package com.butterfly.mvc.action;

import com.butterfly.mvc.form.ActionForm;
import com.butterfly.mvc.form.LoginForm;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by WOLF on 2016/9/19.
 */
public class LoginAction extends Action {
    @Override
    public String execute(ActionForm formBean, HttpServletRequest request, HttpServletResponse response) {
        System.out.println("in method execute");
        String url = "fail";
        LoginForm loginForm = (LoginForm) formBean;
        if("wolf".equals(loginForm.getUserName())){
            url = "success";
        }
        return url;
    }

    public String login(ActionForm formBean, HttpServletRequest request, HttpServletResponse response) {
        System.out.println("in method login");
        return execute(formBean,request,response);
    }
}
